HatchShape AddPolygon
Adds a polygon boundary to the HatchShape.
Overloads
| public void AddPolygon(IEnumerable<Point3D> vertices) |
Return value
| void |
Parameters
| IEnumerable<Point3D> | vertices | A list of vertices which define the polygon |
Example
Copy
scanDocument = scanDeviceManager.CreateScanDocument(GetselectedDeviceUniqueName(), DistanceUnit.Millimeters, false);
if (scanDocument != null)
{
VectorImage vectorImage = scanDocument.CreateVectorImage("image1", DistanceUnit.Millimeters);
vectorImage.SetMarkSpeed(1000);
vectorImage.SetJumpSpeed(2000);
vectorImage.SetJumpDelay(100);
vectorImage.SetMarkDelay(100);
//Set Laser Delays
vectorImage.SetLaserOnDelay(10);
vectorImage.SetLaserOffDelay(10);
IList<Point3D> pl1 = new List<Point3D>();
pl1.Clear();
pl1.Add(new Point3D(10, 10, 0));
pl1.Add(new Point3D(0, 30, 0));
pl1.Add(new Point3D(-10, 10, 0));
pl1.Add(new Point3D(-30, 0, 0));
pl1.Add(new Point3D(-10, -10, 0));
pl1.Add(new Point3D(0, -30, 0));
pl1.Add(new Point3D(10, -10, 0));
pl1.Add(new Point3D(30, 0, 0));
pl1.Add(new Point3D(10, 10, 0));
vectorImage.AddPolygon(pl1);
HatchShape hatchShape = new HatchShape();
hatchShape.AddPolygon(pl1);
hatchShape.AddHatchPatternLine(0.5f, HatchLineBorderGapDirection.Inward, 0.1f,
0, 0, 0, HatchLineStyle.Unidirectional, false,
HatchOffsetAlgorithm.DirectOffset, HatchCornerStyle.Sharp);
vectorImage.AddHatch(hatchShape,0);
scanDocument.Scripts.Add(new ScanningScriptChunk("defaultScript", "ScanAll()"));
try
{
scanDocument.StartScanning();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}